package com.sale.system.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.sale.common.mybatis.annotation.DataColumn;
import com.sale.common.mybatis.annotation.DataPermission;
import com.sale.common.mybatis.core.mapper.BaseMapperPlus;
import com.sale.system.domain.AccountsEmpty;
import com.sale.system.domain.PullDown;
import com.sale.system.domain.SysAccounts;
import com.sale.system.domain.dto.SysAccountsDetailsDto;
import com.sale.system.domain.dto.SysAccountsDto;

import java.util.List;

/**
 * @Description
 * @Param
 * @Date
 * @Author hl
 **/
public interface SysAccountsMapper extends BaseMapperPlus<SysAccountsMapper, SysAccounts, SysAccounts> {

    @DataPermission({
        @DataColumn(key = "deptName", value = "d.dept_id"),
        @DataColumn(key = "userName", value = "u.user_id")
    })
    @InterceptorIgnore(tenantLine = "true")
    List<SysAccountsDto> selectAccountsList(Long userId);

    String selectTenantMerlin(String userName);

    /**
     * 查询账套明细集合
     * @param accountsId
     * @return
     */
    @InterceptorIgnore(tenantLine = "true")
    SysAccountsDetailsDto selectAccountsDetailsList(Long accountsId);


    /**
     * 无账套的情况下(新增)
     *
     * @param accountsEmpty
     * @return int
     */
    int insertAccountsEmpty(AccountsEmpty accountsEmpty);

    /**
     * 注册新增账套
     * @param sysAccounts
     * @return
     */
    boolean add(SysAccounts sysAccounts);

    /**
     * 账套下拉
     */
    @InterceptorIgnore(tenantLine = "true")
    List<PullDown> accountsDown(Long userId);

    /**
     * 新增账套关系
     */
    void insertSysAccountsUser(SysAccounts sysAccounts);
}
